#ifndef _MYCANVAS_H_
#define _MYCANVAS_H_

#include "wx/wx.h"

#define MAX_MSG_CNT 12
#define DISPALY_MSG_LEN 100*(ROW_INTERVAL_LEN+20)

#define ARROW_X_OFFSET 10
#define ARROW_Y_OFFSET 5

#define TEXT_X_OFFSET 20
#define TEXT_Y_OFFSET 30

#define COLUMN_INTERVAL_LEN 200
#define ROW_INTERVAL_LEN 40

#define TEXT_RECT_LEN       80
#define TEXT_RECT_WIDTH  60


class MsgInfo: public wxObject{
    public:
        wxString  sTxt;
        wxPoint   pt1;
        wxPoint   pt2;

        long  beginpos;
        long  endpos;
};

class MyCanvas: public wxScrolledWindow
{
public:
    MyCanvas() {}
    MyCanvas( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size );
    ~MyCanvas(){WX_CLEAR_LIST(wxList, m_msglist);};

    //void OnPaint( wxPaintEvent &event );
    virtual void OnDraw(wxDC& dc);

    void OnMouseRightDown( wxMouseEvent &event );
    void OnMouseLeftDown( wxMouseEvent &event );
    void OnMouseWheel( wxMouseEvent &event );
    void DrawNewMessage( wxDC &dc,wxString sTxt,wxPoint pt1,wxPoint pt2);
    void DrawAMessage( wxDC &dc,MsgInfo *oMsginfo);

    wxList      m_msglist;
    wxPoint    m_currentpos;
    wxTextCtrl *m_msgtext;

    DECLARE_DYNAMIC_CLASS(MyCanvas)
    DECLARE_EVENT_TABLE()
};

#endif // _MYCANVAS_H_
